import fetch from "node-fetch";

const regular = [
    /^(#|\/)?(h|H)?(人生模拟器|模拟人生|重开)$/,
]

/*
* 本插件由Jiaozi饺子制作
* 侵权联系我删除https://gitee.com/tu-zhengxiong0925
*/

export class example extends plugin {
    constructor() {
        super({
            name: '[Help小功能]人生模拟器',
            dsc: '去死吧这个操蛋的人生',
            event: 'message',
            priority: -1145145,
            rule: [
                { reg: regular[0], fnc: 'ck' },
           ]
        });
    }

    async ck(e) {
    await e.reply('正在重生，请稍候...', false,{ recallMsg: 30 });

    const apiUrl = 'https://api.andeer.top/API/private_remake.php';

    try {
        const response = await fetch(apiUrl);
        const result = await response.json();

        if (result.success) {
            const imageUrl = result.data;

            await e.reply(segment.image(imageUrl),{quote:true});
        } else {
            await e.reply('请求失败：' + result.message, false);
        }
    } catch (error) {
        await e.reply('发生错误：' + error.message, false);
    }
    }


}